#include "DysList.hpp"

template <class T>
DysList<T>::DysList()
{
    _capacity = 100;
    array = new T[100];
    _size = 0;
}

template <class T>
DysList<T>::~DysList()
{
    delete array;
}

template <class T>
T DysList<T>::get(int index)
{
    if (index < _size && index >= 0)
    {
        return array[index];
    }
    else
    {
        throw "index out of bounds.";
    }
}

template <class T>
void DysList<T>::add(T e)
{
    if (_size < _capacity)
    {
        array[_size++] = e;
    }
    else
    {
        throw "size out of bounds.";
    }
}

template <class T>
int DysList<T>::size()
{
    return _size;
}

template <typename T>
Iterator<T> *DysList<T>::getIterator()
{
    return new Iterator<T>(this);
}
